Mostly Harmless

Legacy:Image Conversion

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

This is another one of those "because I needed it" files. It's not well written, it doesn't do much error checking or have many user options. It's a very short program in C to convert files between different image formats, including dds (DXT texture files). It requires DevIL, which you can get from http://openil.sf.net/, and probably also from your Linux distribution if you are using Linux.

Compile it like this:

gcc -o devilconvert -lIL -lILU devilconvert.c

and use it like this:

devilconvert file1.ext file2.ext

DevIL's load and save functions autodetect file formats, so you can fairly easily convert a bmp or png to a dds, tga, or pcx for use with your mod.

I have it online at http://chshrcat.homelinux.net/devilconvert.c, but here it is in the Wiki as well:

#include <IL/il.h>
#include <IL/ilu.h>
 
int main(int argc, char *argv[]) {
	int i;
	if (argc != 3)
		exit(1);
 
	ilInit();
	iluInit();
	ilBindImage(1);
 
	ilLoadImage(argv[1]);
	i = ilGetError();
	if(i != IL_NO_ERROR) {
		printf("%s\n",iluErrorString(i));
		exit(1);
	}
 
	ilSaveImage(argv[2]);
	i = ilGetError();
	if(i != IL_NO_ERROR) {
		printf("%s\n",iluErrorString(i));
		exit(1);
	}
}

Yes, this is crap code. It is exactly good enough for what I need it to do ;-)

G-LiTe:: ImageMagick includes a commandline program called "convert" which (at the time of writing) supports 87 image formats. It's got lots of options, but unfortunatly cannot read or save DXT files. Just thought it was worth mentioning here, maybe someone in here can write a DXT thingy for it. I'm too lazy. ;) Most linux distributions include it or even have it installed by default.